﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GenericLibrariesToolKit;
using Utils;

namespace Model
{
    /// <summary>
    /// 招/投标实体
    /// </summary>
    public class Bid
    {
        /*招标ID*/
        public string BidId { get; set; }
        /*企业ID*/
        public string EnterpriseId { get; set; }
        /*招标标题*/
        public string BidTitle { get; set; }
        /*招标行业*/
        public string BidIndustry { get; set; }
        /*联系方式*/
        public string ContactType { get; set; }
        /*地址*/
        public string BidAddress { get; set; }
        /*电话*/
        public string BidPhone { get; set; }
        /*传真*/
        public string BidFax { get; set; }
        /*Email*/
        public string BidEmail { get; set; }
        /*开始日期*/
        private string startDate = DateTimeUtil.GetDateTime();
        public string StartDate
        {
            get { return startDate;}
            set { startDate = value; }
        }
        /*结束日期*/
        private string endDate = DateTimeUtil.GetDateTime();
        public string EndDate
        {
            get { return endDate; }
            set { endDate = value; }
        }

        /*是否过期*/
        public int IsExpire { get; set; }
        /*中标人，竞标成功后添加*/
        public string ExpertId { get; set; }
        /*细节*/
        public string BidDetail { get; set; }


        /// <summary>
        /// 应用程序启动时，实体管理器将会调用此方法进行初始化。
        /// </summary>
        public void Intialization()
        {
            //声明一个实体实体对象
            Entity entity = new Entity();

            //指定该实体对应数据库中的表名
            entity.TableName = "T_BID";
            //指定该实体的标识符
            entity.EntityId = "BidId";
            //指定主键生成策略
            entity.Generator = GenericLibrariesToolKit.Enumeration.PKGenerationStrategy.GUID;
            ///实体关系映射字典
            ///key:实体属性名称，value:对应的数据库中表的字段名
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            dictionary.Add("BidId", "BID_ID");
            dictionary.Add("EnterpriseId", "ENTERPRISE_ID");
            dictionary.Add("BidTitle", "BID_TITLE");
            dictionary.Add("BidIndustry", "BID_INDUSTRY");
            dictionary.Add("ContactType", "CONTACT_TYPE");
            dictionary.Add("BidAddress", "BID_ADDRESS");
            dictionary.Add("BidPhone", "BID_PHONE");
            dictionary.Add("BidFax", "BID_FAX");
            dictionary.Add("BidEmail", "BID_EMAIL");
            dictionary.Add("StartDate", "START_DATE");
            dictionary.Add("EndDate", "END_DATE");
            dictionary.Add("IsExpire", "ISEXPIRE");
            dictionary.Add("ExpertId", "EXPERT_ID");
            dictionary.Add("BidDetail", "BID_DETAIL");

            //赋值
            entity.ORMDictionary = dictionary;

            //将实体加入实体管理器，
            EntityManager.GetInsatnce().AddEntity("Model.Bid", entity);
        }
    }
}
